package scottb.flex;

import java.awt.*;
import java.util.ArrayList;

public abstract class FlexLayoutManager implements LayoutManager {

    protected Dimension[] getChildrenSizes(FlexLayout flex) {

        java.util.List<Dimension> sizes = new ArrayList<Dimension>();

        for(Component childComponent : flex.getComponents()) {

            sizes.add(childComponent.getPreferredSize());
        }

        return sizes.toArray(new Dimension[0]);
    }

    public Dimension minimumLayoutSize(Container parent) {

        return preferredLayoutSize(parent);
    }

    public void addLayoutComponent(String s, Component component) {
        // ignore
    }

    public void removeLayoutComponent(Component component) {
        // ignore
    }
}
